home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Mania 6
/
MacMania 6.toast
/
/
Multimedia & Desktop
/
VideoToolbox
/
VideoToolboxSources
/
GetTimeDateString.c
< prev
next >
Wrap
Text File
|
1995-07-27
|
772b
|
31 lines
/*
GetTimeDateString
Return a malloced string with the time and date in a nice format:
"5:03 PM, Monday, September 13, 1993"
You may supply a calendar time, as returned by time(), or you may supply 0 to
use the current time.
HISTORY:
8/93 dhb,jms wrote it, using Apple toolbox.
9/13/93 dgp rewrote it using Standard C library.
9/16/93 dhb Fixed name of routine in PrintfExit.
7/16/94 dgp suppress leading zero in hours.
*/
#include "VideoToolbox.h"
#ifndef _TIME
#include <time.h> /* Standard C library */
#endif
char *GetTimeDateString(time_t t)
{
char *s;
s=malloc(64);
if(s==NULL)PrintfExit("GetTimeDateString: malloc(64) failed.\n");
if(t==0)t=time(NULL);
strftime(s,64,"%I:%M %p, %A, %B %d, %Y",localtime(&t));
if(s[0]=='0')strcpy(s,s+1);
return(s);
}